import Vue from 'vue'
import Vuex from 'vuex'
import axios from 'axios'

Vue.use(Vuex)

const store = new Vuex.Store({
  state: {
  },
  mutations: {
  },
  actions: {
    api_verify_code: context => {
      return new Promise((resolve, reject) => {
        axios.get('/api/v1/product/verify_code/').then(resp => {
          resolve(resp)
        }).catch(error => {
          reject(error)
        })
      })
    },
    api_submit_contact: (context, data) => {
      return new Promise((resolve, reject) => {
        axios.post('/api/v1/product/contact/', data).then(resp => {
          resolve(resp)
        }).catch(error => {
          reject(error.response)
        })
      })
    }
  }
})
export default store
